package Common;


import helpers.IDomainModelLister;
import helpers.IModelSerializer;
import helpers.IModelValidator;
import helpers.IQueryFormer;
import helpers.QueryFormer;
import helpers.ModelSerializer;
import helpers.ModelValidator;
import helpers.DomainModelLister;

import persistencia.DAOgenerico;
import persistencia.IDAOTEMPLATE;

public class InstancesPool {
/*
 * LA idea es lograr algo tipo IOC para poder cambiar las 
 * implementaciones a piaccere
 */
	
	IDAOTEMPLATE dao;
	IModelSerializer mSerializer;
	IModelValidator mValidator;
	IQueryFormer HQLformer;
	IDomainModelLister DomainModelLister;
	static InstancesPool instance = null;
	
	
	private InstancesPool() 
	{
		//Here is where we can change implementations without any impact
		dao = DAOgenerico.getInstance();
		mSerializer = new ModelSerializer();
		mValidator = new ModelValidator();
		HQLformer = new QueryFormer();
		DomainModelLister = new DomainModelLister();
	}

	public synchronized static InstancesPool getInstance() {
        if (instance == null) {
            instance = new InstancesPool();
        }
        return instance;
    }
	
	
	public void setDao(IDAOTEMPLATE dao) {
		this.dao = dao;
	}

	public void setmSerializer(IModelSerializer mSerializer) {
		this.mSerializer = mSerializer;
	}

	public void setmValidator(IModelValidator mValidator) {
		this.mValidator = mValidator;
	}

	public IDAOTEMPLATE getDao() {
		return dao;
	}

	public IModelSerializer getmSerializer() {
		return mSerializer;
	}

	public IModelValidator getmValidator() {
		return mValidator;
	}

	public IQueryFormer getHQLformer() {
		return HQLformer;
	}

	public void setHQLformer(IQueryFormer hQLformer) {
		HQLformer = hQLformer;
	}

	public IDomainModelLister getDomainModelLister() {
		return DomainModelLister;
	}

	public void setDomainModelLister(IDomainModelLister domainModelLister) {
		DomainModelLister = domainModelLister;
	}


	
}
